home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Standards 1994 January / InfoMagic Standards - January 1994.iso / misc / mail / format.qwk
Internet Message Format  |  1992-02-11  |  14KB

  1. From aboba@world.std.com Tue Feb 11 19:04:55 1992
  2. Newsgroups: alt.bbs,comp.mail.misc,alt.bbs.internet
  3. From: aboba@world.std.com (Bernard D Aboba)
  4. Subject: Re: looking for spec for ".qwk" mailbox format
  5. Organization: The World Public Access UNIX, Brookline, MA
  6. Date: Tue, 11 Feb 1992 08:15:40 GMT
  7.  
  8. Here is the spec for the .QWK format. Hopefully this info will prove
  9. useful to someone writing a QWK reader for UNIX. 
  10.  
  11.  
  12.                      IMMMMMMMMMMMMMMMMMMMMMMMMMMMM;
  13.                      : The QWK Mail Packet Format :
  14.                      HMMMMMMMMMMMMMMMMMMMMMMMMMMMM<
  15.  
  16. BBS ID
  17. DDDDDD
  18.  
  19.     The BBS ID is a 1-8 characters string that identifies a BBS' mail
  20.     packet.  The filename of the mail packet is often the BBS ID.
  21.     However, this is not always the case, so do not rely on that to
  22.     determine the BBS ID.  Instead, it is included on the fifth line of
  23.     the CONTROL.DAT file (see below.)
  24.  
  25. Compression
  26. DDDDDDDDDDD
  27.  
  28.     Most mail packets are compressed when create by the mail door.  The
  29.     most common archiver is PKZIP, but others such as LHA is being used.
  30.     However, many current off-line reader programs do allow the user to
  31.     unarchive a mail packet before entering the reader program, so the
  32.     reader will not unarchive it again.  Upon exit, the reader will not
  33.     call the archiver to save it.  It is up to the user to archive the
  34.     replies.
  35.  
  36. MESSAGES.DAT
  37. DDDDDDDDDDDD
  38.  
  39.     The QWK file format is based on the PCBoard 12.0 message base
  40.     formats from Clark Development Corporation.
  41.  
  42.     All of the messages in a mail packet are contained in a single file
  43.     named MESSAGES.DAT.  The file's logical record length is 128 bytes.
  44.     The first record of MESSAGES.DAT always contains a copyright notice
  45.     saying "Produced by Qmail...Copyright (c) 1987 by Sparkware.  All
  46.     Rights Reserved".  Messages start in record 2 and use this format:
  47.  
  48.     Offset  Length  Description
  49.     ------  ------  ----------------------------------------------------
  50.       1       1     Message status flag
  51.                     ' ' = public, unread
  52.                     '-' = public, read
  53.                     '+' = private, unread
  54.                     '*' = private, read
  55.                     '~' = comment to Sysop, unread
  56.                     '`' = comment to Sysop, read
  57.                     '%' = password protected, unread (protect by sender)
  58.                     '^' = password protected, read (protect by sender)
  59.                     '!' = password protected, unread (protect by group
  60.                           password)
  61.                     '#' = password protected, read (protect by group
  62.                           password)
  63.                     '$' = password protected, addressed to all (protect
  64.                           by group password)
  65.       2       7     Message number (in ASCII)
  66.       9       8     Date (mm-dd-yy)
  67.      17       5     Time (24 hour hh:mm)
  68.      22      25     To (uppercase)
  69.      47      25     From (uppercase)
  70.      72      25     Subject of message
  71.      97      12     Password (usually space filled)
  72.     109       8     Reference message number (in ASCII)
  73.     117       6     Number of 128 byte blocks in message (counting the
  74.                     header, in ASCII)
  75.     123       1     Is message killed?  ASCII 225 is active, 226 is
  76.                     killed
  77.     124       2     Conference number (as long integer), 124 is the
  78.                     least significant, 125 is most
  79.     125       3     Not used (usually filled with space)
  80.  
  81.     The text of message continues in the next record.  You can find out
  82.     how many blocks make up one message by looking at the value of
  83.     "Number of 128 byte blocks".  Message text is delimited by a ASCII
  84.     227 (pi character) symbol between lines.
  85.  
  86. xxx.NDX
  87. DDDDDDD
  88.  
  89.     The xxx.NDX files contain record numbers that point into the
  90.     MESSAGES.DAT file for actual messages.  Each conference that
  91.     contains messages has its own "xxx.NDX" file.  The "xxx" is the
  92.     conference number for the index file.
  93.  
  94.     Each NDX file uses a five bytes logical record length and is
  95.     formatted to:
  96.  
  97.     Offset  Length  Description
  98.     ------  ------  ----------------------------------------------------
  99.       1       4     Record number pointing to corresponding message in
  100.                     MESSAGES.DAT.  This number is in the Microsoft MKS$
  101.                     BASIC format.
  102.       5       1     Conference number of the message.  This byte should
  103.                     not be used because it duplicates both the filename
  104.                     of the index file and the conference # in the
  105.                     header.  It is also one byte long, which cannot
  106.                     handle conferences over 255.
  107.  
  108.     The formula for converting X, a long integer in MKS$ format, to
  109.     MKSToNum, a binary integer, is:
  110.  
  111.     MKSToNum := ((X AND NOT $ff000000) OR $00800000)
  112.                 SHR (24 - ((x SHR 24) AND $7f));
  113.  
  114.     Or in Turbo Pascal:
  115.  
  116.     type
  117.         bsingle = array [0..3] of byte;
  118.  
  119.     { converts TP real to Microsoft 4 bytes single }
  120.  
  121.     procedure real_to_msb (preal : real; var b : bsingle);
  122.     var
  123.         r : array [0 .. 5] of byte absolute preal;
  124.     begin
  125.         b [3] := r [0];
  126.         move (r [3], b [0], 3);
  127.     end; { procedure real_to_msb }
  128.  
  129.     { converts Microsoft 4 bytes single to TP real }
  130.  
  131.     function msb_to_real(b : bsingle) : real;
  132.     var
  133.         preal : real;
  134.         r : array [0..5] of byte absolute preal;
  135.     begin
  136.         r [0] := b [3];
  137.         r [1] := 0;
  138.         r [2] := 0;
  139.         move (b [0], r [3], 3);
  140.         msb_to_real := preal;
  141.     end; { procedure msb_to_real }
  142.  
  143.     There is a special index file named PERSONAL.NDX.  This file
  144.     contains pointers to messages which are addressed to the user, i.e.
  145.     personal messages.  Some mail door and utility programs also allow
  146.     the selection of other messages to be flagged as personal messages
  147.     as well.
  148.  
  149. CONTROL.DAT
  150. DDDDDDDDDDD
  151.  
  152.     The CONTROL.DAT file is a simple ASCII file.
  153.  
  154.     Aardvark BBS                    BBS long name
  155.     New York, NY                    BBS city and state
  156.     212-496-8324                    BBS number
  157.     David Greenberger, Sysop        BBS Sysop name
  158.     20052,AARDVARK                  Mail door registeration #, BBS ID
  159.     10-19-1990,00:36:13             Packet creation time
  160.     PATRICK LEE                     User name
  161.                                     Name of menu for Qmail, if exists
  162.     0                               ?
  163.     0                               ?
  164.     121                             Total number of conf. minus 1
  165.     0                               1st conference number
  166.     Main Board                      1st conference name
  167.     1                               2nd conference number
  168.     General                         2nd conference name
  169.     3                               etc. onward until it hits max. conf.
  170.     123                             Last conference number
  171.     Amiga_I                         Last conference name
  172.     HELLO                           Welcome screen file
  173.     NEWS                            BBS news file
  174.     SCRIPT0                         Log off screen
  175.  
  176.     [ Some mail doors do not send the information below here. ]
  177.  
  178.     0                               ?
  179.     25                              ?
  180.     PATRICK LEE                     User name in uppercase
  181.     Patrick                         User first name
  182.     ELMHURST, NEW YORK              User city, state
  183.      718 639-6696                   User data phone
  184.      718 639-6696                   User home phone
  185.     108                             Security level
  186.     00-00-00                        Expiration date
  187.     10-17-90                        Last log on date
  188.     23:22                           Last log on time
  189.     209                             Log on count
  190.     0                               ?
  191.     0                               Total KB downloaded
  192.     34                              Download count
  193.     0                               Total KB uploaded
  194.     110                             Upload count
  195.     120                             Minutes per day
  196.     52                              Minutes remaining today
  197.     3                               Minutes used this call
  198.     32767                           Max. download KB per day
  199.     32767                           Remaining KB today
  200.     0                               KB downloaded today
  201.     00:36                           Current time on BBS
  202.     10-19-90                        Current date on BBS
  203.     Aardvark BBS                    BBS name
  204.     5059                            ?
  205.  
  206. Replies
  207. DDDDDDD
  208.  
  209.     Replies use a similar format, except the message number becomes the
  210.     conference number.  Also, the first record (up to 8 characters
  211.     starting on the first byte) in the reply file contains the BBS's ID.
  212.     This ID must much the one on the BBS in order for the mail door to
  213.     accept the replies.
  214.  
  215. Pointer files
  216. DDDDDDDDDDDDD
  217.  
  218.     *.PTR or *.PNT
  219.  
  220.     Don't bother with the pointer files, as the off-line reader has no
  221.     real use for it.  The mail doors send it so that the user will have
  222.     a copy of it, in case something on the BBS screws up.
  223.  
  224. Other files
  225. DDDDDDDDDDD
  226.  
  227.     Bulletins are sometimes send in the mail packet as well, this is
  228.     usually configurable by the user.  The files for the bulletins are
  229.     named:
  230.  
  231.         BLT-x.y
  232.  
  233.     where 'x' is the conference number, and 'y' is the bulletin number.
  234.  
  235.     New files are also configurable and can be sent by the mail door.
  236.     The file name for that is NEWFILES.DAT
  237. .
  238. Off-line mail door configuration
  239. DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
  240.  
  241.     For Qmail 4.0a:
  242.  
  243.         Send a private message addressed to "QMAIL" with a subject of
  244.         "CONFIG" (without quotes).  Then, enter any of the commands
  245.         listed below inside the text of your message.  Remember to use
  246.         one command per line.
  247.  
  248.         ADD <confnum>           Add a conference into the Qmail Door
  249.                                 4.00 scanning list. "YOURS" can also be
  250.                                 added to the command if the user wishes
  251.                                 to receive messages only addressed them.
  252.                                 Example: ADD 1 YOURS
  253.         DROP <confnum>          Drop a conference from the Qmail Door
  254.                                 4.00 scanning list.
  255.         RESET <confnum> <value> Resets a conference to a particular
  256.                                 value. The user can use "HIGH-xxx" to
  257.                                 set the conference to the highest
  258.                                 message in the base.
  259.         CITY <value>            Changes the "city" field in the User's
  260.                                 PCBoard entry.
  261.         PASSWORD <value>        Changes the user's login password.
  262.         BPHONE <value>          Business/data phone number
  263.         HPHONE <value>          Home/voice phone number
  264.         PCBEXPERT <on|off>      Turns the PCBoard EXPERT mode ON or OFF.
  265.         PCBPROT <value>         PCBoard file transfer protocol (A-Z).
  266.         PAGELEN <value>         Page length inside PCBoard.
  267.         PCBCOMMENT <value>      User maintained comment.
  268.         AUTOSTART <value>       Qmail Door autostart command.
  269.         PROTOCOL <value>        Qmail Door file transfer protocol (A-Z).
  270.         EXPERT <on|off>         Turns the Qmail Door EXPERT mode ON or
  271.                                 OFF.
  272.         MAXSIZE <value>         Maximum size of the user's .QWK packet
  273.                                 (in bytes)
  274.         MAXNUMBER <value>       Maximum number of messages per
  275.                                 conference.
  276.  
  277.     For MarkMail:
  278.  
  279.         Send a private message addressed to "MARKMAIL" with the subject
  280.         line of:
  281.  
  282.         "ADD" in the conference you want to add
  283.         "DROP" in the conference you want to drop
  284.         "YOURS" in the conference you want only your mail sent
  285.         "FILES ON" or "FILES OFF" in any conference to tell MarkMail
  286.             whether to scan for new files or not.
  287.         "BLTS ON" or "BLTS OFF" to turn on and off, respectively, of
  288.             receiving bulletins.
  289.         "OWN ON" or "OWN OFF" to turn on and off, respectively, of
  290.             receiving messages you sent
  291.         "DELUXE ON" or "DELUXE OFF" to turn on and off, respectively, of
  292.             receiving DeLuxe menu
  293.         "LIMIT size" to set the maximum size of MESSAGES.DAT file can
  294.             be, it cannot exceed what the Sysop has set up
  295.  
  296.         After "ADD" or "YOURS", you can also put in the message number
  297.         you want to reset the conference to; or you can enter a relative
  298.         number, i.e. -50, to reset the message pointer to the highest in
  299.         the conference minus 50.
  300.  
  301. Non-echoed messages
  302. DDDDDDDDDDDDDDDDDDD
  303.  
  304.     In order to send a non-echoed message (not send out to other BBSes),
  305.     a user can enter "NE:" in front of the subject line.  The MarkMail
  306.     door will strip this "NE:" and turn off the echo flag.
  307.  
  308. Taglines
  309. DDDDDDDD
  310.  
  311.     The most common format for a reader tag-line is:
  312.  
  313.     ---
  314.      ~ My reader v1.00 ~ The rest of the tag-line.
  315.  
  316.     The three dashes is called a tear-line.  The tag-line is appended to
  317.     the end of the message and is usually one line only.
  318.  
  319. DOOR.ID
  320. DDDDDDD
  321.  
  322.     DOOR = <doorname>
  323.  
  324.         This is the name of the door that created the QWK packet, i.e.
  325.         <doorname> = Tomcat.
  326.  
  327.     VERSION = <doorversion>
  328.  
  329.         This is the version number of the door that created the packet,
  330.         i.e. <doorversion> = 2.9.
  331.  
  332.     SYSTEM = <systemtype>
  333.  
  334.         This is the underlying BBS system type and version, i.e.
  335.         <systemtype> = Wildcat 2.55.
  336.  
  337.     CONTROLNAME = <controlname>
  338.  
  339.         This is the name to which the reader should send control
  340.         messages, eg. <controlname> = TOMCAT.
  341.  
  342.     CONTROLTYPE = <controltype>
  343.  
  344.         This can be one of ADD, DROP, or REQUEST (or others.)  ADD and
  345.         DROP are pretty obvious (they work as in MarkMail), and REQUEST
  346.         is for use with BBS systems that support file attachments.  Try
  347.         out SLMR with CONTROLTYPE = REQUEST and use the Q function.
  348.  
  349.     RECEIPT
  350.  
  351.         This flag indicates that the door/BBS is capable of return
  352.         receipts when a message is received.  If the first three letters
  353.         of the subject are RRR, then the door should strip the RRR and
  354.         set the 'return-receipt-requested' flag on the corresponding
  355.         message.
  356.  
  357.  
  358.  
  359.